home *** CD-ROM | disk | FTP | other *** search
- This sample application shows you how to display a vbx control in a
- dialog box that is a resource of an AFXDLL. The dialog template contains
- a list of the controls for the dialog box. One of the items in this list
- is the class name for the control. Since VBX controls are not standard
- Windows controls they do not have a class name. MFC works around this by
- providing a Windows class, VBControl, which it can use to create VBX
- controls. The VBControl class is used as the class name in the dialog
- template for every VBX control used in the dialog.
-
- When the application that calls the DLL calls the EnableVBX()
- function, it registers the VBControl window class with Microsoft
- Windows. The VBControl class is registered as a local window class,
- not as a global window class. A local window class is available only
- to the module in which the class is registered. Because a DLL has its
- own module that is different from the calling application, the VBControl
- class is not available to the DLL.
-
- Workarounds:
-
- [1] The application can call the Create() member function of the CVBControl
- class to create the VBX control. Call Create() in the OnInitDialog()
- function (for a modal dialog box) or in the OnCreate() function (for
- a modeless dialog box).
-
- [2] Re-register the VBControl class in the DLL so that it can be used from
- the DLL. Also, change the resorce instance handle during the
- OnInitDialog() function so that resource in the DLL will be used while
- the controls are being created.
-
- This second method is demontrated in the sample.
-
-
-